import 'package:daoyi_ui_admin_getx/app/modules/home/info/info_data.dart';
import 'package:daoyi_ui_admin_getx/generated/locales.g.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'info_item_widget.dart';

class InfoWidget extends StatelessWidget {
  final bool showTitle;
  final List<InfoItem> dataList;

  const InfoWidget({
    super.key,
    this.showTitle = false,
    this.dataList = infoData,
  });

  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        if (showTitle)
          Container(
            alignment: Alignment.centerLeft,
            padding: const EdgeInsets.all(10),
            child: Text(
              LocaleKeys.pages_home_latest_news.tr,
              style: const TextStyle(
                fontSize: 16,
                fontWeight: FontWeight.bold,
              ),
            ),
          ),
        Column(
          children: dataList
              .map(
                (item) => InfoItemWidget(item),
              )
              .toList(),
        ),
      ],
    );
  }
}
